
// The Ambiguity of Fishing for Fun, October 2022
// This file estimates the mixed logit model (Table A-7)

use ReadyDataFluke.dta, clear 

*Mean keep and release summer flounder 
gen SFkeptmean=0
gen SFreleasemean=0
local i=0
while `i' <=25 {
 replace SFkeptmean= SFkeptmean+ SFkeep_`i'* Pcatch_`i'
 replace SFreleasemean= SFreleasemean+ SFrelease_`i'* Pcatch_`i'
 local i= `i' + 1
 }

mixlogit chosen Priceline,  group(Identifier) id(id_code) rand(SFreleasemean SFkeptmean ReleaseOther KeepOther opt_out)
putexcel set "G:\My Drive\RESEARCH\WORKING PAPERS\McConnell_Holzer on Responses to Risky Catch\Matlab code\estimation\parameters_mixed.xlsx", replace
    putexcel A1 = matrix(e(b))
putexcel set "G:\My Drive\RESEARCH\WORKING PAPERS\McConnell_Holzer on Responses to Risky Catch\Matlab code\estimation\sigma_mixed.xlsx", replace	
    putexcel A1 = matrix(e(V))
estat vce
estat ic 
